home *** CD-ROM | disk | FTP | other *** search
/ PC Home 138 / PC Home issue 138.iso / Software / Essentials / Netscape / nim.xpi / bin / chrome / aim.jar / content / aim / AimMainObserver.js < prev    next >
Encoding:
JavaScript  |  2001-09-10  |  1.5 KB  |  45 lines

  1. // Setting up stage to have one main Observer, so we dont have tons of observers for Aim state changes 
  2.  
  3. // Global variables which get set based on the buddylist panel  is Sidebar/App
  4. var IsApp =false;
  5. var IsSidebar = true;
  6.  
  7. /*
  8.  * Function: CheckIfApp(inType)
  9.  * Arguments: 
  10.  *      inType -- the name of the window type 
  11.  * Return: Boolean
  12.  * Description: This function is called on load of buddylist panel. It will check if the window is standalone
  13.  * type and return true if it is. It uses the window manager interface to check if any window of input type exists.
  14. */
  15.  
  16. function CheckIfApp(inType)
  17. {
  18.   var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
  19.   var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
  20.   var topWindow = windowManagerInterface.getMostRecentWindow( inType );
  21.   if (topWindow) {
  22.       IsApp=true;
  23.       return true
  24.     }
  25.   return false;
  26. }                     
  27.  
  28. /*
  29.  * Function: CheckIfSidebar()
  30.  * Arguments: None
  31.  * Return: Boolean
  32.  * Description: This function is called on load of buddylist panel. It will check if the window is sidebar.
  33.  * It basically looks for the ad-box which is missing in sidebar. If there is no adbox, then it is sidebar, if it
  34.  * exists then it is standalone.
  35. */
  36.  
  37. function CheckIfSidebar()
  38. {
  39.   if (top.document.getElementById("ad-box"))
  40.   {
  41.       IsSidebar=false;
  42.       return false;
  43.     }
  44.   return true;
  45. }